/*
** direct_too_big.c for asm in /home/vanet_c//proj-kw/asm/folder_syntax
** 
** Made by charles-edouard vanet
** Login   <vanet_c@epitech.net>
** 
** Started on  Fri Dec 14 14:46:44 2012 charles-edouard vanet
** Last update Sat Dec 15 15:54:05 2012 charles-edouard vanet
*/

#include	"../../includes/asm.h"

void	direct_msg(t_list **list, t_my_file **my_file)
{
  my_fd_putchar('\t', 2);
  my_stderror((*list)->name);
  my_stderror(" : Warning direct too big line ");
  my_put_nbr_error((*my_file)->line_nb);
  my_fd_putchar('\n', 2);
}

int	direct_too_big(t_list **list, t_my_file **my_file)
{
  int	direct;
  int	i;
  char	**tab;

  i = 0;
  direct = 0;
  tab = (*my_file)->tab_instruction;
  while (tab[++i])
    {
      if (char_cmp(tab[i][0], DIRECT) == 0)
	{
	  if (tab[i][1] == '\0')
	    syntax_msg(list, my_file, "\0");
	  direct = my_getnbr(tab[i] + 1);
	  if (direct > DIRECT_MAX)
	    direct_msg(list, my_file);
	}
    }
  return (0);
}
